﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class eduExamPaperPrint : System.Web.UI.Page
{
    DataClassesDataContext SMSDC = new DataClassesDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            DataTable dlg_tb = new DataTable();
			DataColumn colWork = new DataColumn("说明", System.Type.GetType("System.String"));
			dlg_tb.Columns.Add(colWork);

            int m_CourseID = Convert.ToInt32(this.Request.QueryString["CourseID"]);

            var a = (SMSDC.Edu_GetLocalExamQuestionByCourseID(m_CourseID)).ToArray();
   
            //写表格
            foreach(Edu_GetLocalExamQuestionByCourseIDResult b in a)
            {
                DataRow row = dlg_tb.NewRow();
                row["说明"] = b.QuestionNum +"：" + b.QuestionDes;
                dlg_tb.Rows.Add(row);

                row = dlg_tb.NewRow();
                row["说明"] = "A：" + b.Answer1;
                dlg_tb.Rows.Add(row);

                row = dlg_tb.NewRow();
                row["说明"] = "B：" + b.Answer2;
                dlg_tb.Rows.Add(row);

                row = dlg_tb.NewRow();
                row["说明"] = "C：" + b.Answer3;
                dlg_tb.Rows.Add(row);

                row = dlg_tb.NewRow();
                row["说明"] = "D：" + b.Answer4;
                dlg_tb.Rows.Add(row);
            }
            this.UltraWebGrid1.DataSource = dlg_tb;
            this.UltraWebGrid1.DataBind();
            this.UltraWebGrid1.Columns[0].Width = 800;
        }
    }
}
